<?php
require_once 'lucene/Friend_Search_Lucene_Document.php';

class Custom_Friend {
	
	public $id;
	public $orginalUser;
	public $potentialUser;
	
	/**
	 * Constructor.
	 * 
	 * @param $id
	 * @param $orginalUser
	 * @param $potentialUser
	 */
	public function __construct($id, $orginalUser, $potentialUser) {
		$this->id = $id;
		$this->orginalUser = $orginalUser;
		$this->potentialUser = $potentialUser;
	}
	
	/**
	 * Get searchable fields.
	 * 
	 * @param $friend
	 */
	public static function _getSearchIndexFields($friend) {
		$fields = array();
		$fields[Friend_Search_Lucene_Document::CLASS_NAME] = 'Custom_Friend';
		$fields[Friend_Search_Lucene_Document::KEY] = $friend->id;
		$fields[Friend_Search_Lucene_Document::USERNAME] = $friend->potentialUser->username;
		$fields[Friend_Search_Lucene_Document::EMAIL] = $friend->potentialUser->email;
		return $fields;
	}
}
?>